<?php

$m = new Mongo();

$db = $m->EMU;

$collection = $db->users;

$userQuery = array('user' =>  $_POST['username']);

$cursor = $collection->findOne($userQuery);


if($cursor != NULL)
{
	$collection->remove(array('user' => $_POST['username']), array("justOne" => true));
	Header("Location: ../adminpanel.php");
}
else {
	Header("Location: ../adminpanel.php?error=deleteErrorUser");
}
?>